<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<style>
<!--
.searchContent td label{
width:50px;
}
-->
</style>
<form id="pagerForm" method="post" action="#rel#">
	<input type="hidden" name="pageNum" value="${currentPage }" /> 
	<input type="hidden" name="numPerPage" value="${numPerPage}" /> 
	<input type="hidden" name="orderField" value="${param.orderField}" /> 
	<input type="hidden" name="orderDirection" value="${param.orderDirection}" />
</form>
<div class="pageHeader">
	<form rel="pagerForm" id="show_scl" onsubmit="return divSearch(this,'show_scl_list');"	action="school_search.action" method="post">
		<!--  -->
		<div class="searchBar nowrap">
			<p style="width: 255px;">
				<label>学校名称:</label>
					<input type="text" name="model.sclName" value="${sclName}" maxlength="20" 
						postField="sclName" 
						suggestFields="sclName" 
						suggestUrl="school_suggest.action" 
						lookupGroup="model"/>
					<a style="float: right;" class="btnLook" href="school_lookup.action?numPerPage=10" lookupGroup="model">查找学校</a>
			</p>
			<p>
				<label>学校编号：</label>
				<input type="text" name="sclNumber" value="${sclNumber }" maxlength="5">
			</p>
			<p>
				<label>所属地区：</label>
				<select
					name="areaCode" 
					class="combox" id="list_areaCode" ref="area_county" refUrl="school_getAreaByCity.action?areaCode={value}">
					<option value="">---所有地区---</option>
					<c:forEach items="${application.areaList}" var="area">
						<option ${areaCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>所属县区：</label>
				<select
					name="countyCode" 
					class="combox" id="area_county">
					<option value="">---所有县区---</option>
					<c:forEach items="${countyList}" var="area">
						<option ${countyCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select>
			</p>
			<p><label>部&nbsp;&nbsp;门：</label><select name="deptCode" id="deptCode" class="combox" ref="deptCode_saler"
														refUrl="school_getAllSaler.action?deptCode={value}">
									<option value="">---所有部门---</option>
									<c:forEach items="${deptList }" var="dept">
										<option ${deptCode==dept.deptCode?"selected":""} value="${dept.deptCode}">${dept.deptName}</option>
									</c:forEach>
							</select>
				</p>
				<p><label>市场人员</label>
							<select name="saleUserId" id="deptCode_saler"
								class="required combox">
									<option value="">---请选择---</option>
									<c:forEach items="${saleList}" var="sale">
									<option ${saleUserId==sale.isuId?"selected":""} value="${sale.isuId}">${sale.isuName}</option>
									</c:forEach>
							</select>
				</p>
			<p>
				<label>结算方式：</label>
				<select class="combox" name="balanceTypeFlag">
					<option value="">---所有方式---</option>
					<c:forEach items="${blanceTypeList}" var="blance">
						<option ${balanceTypeFlag==blance.dicCode?"selected":""} value="${blance.dicCode}">${blance.dicName}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>审核状态：</label>
				<select class="combox" name="checkStatusFlag">
					<option value="">---所有状态---</option>
					<option ${checkStatusFlag eq '0'?"selected":""} value="0">未审核</option>
					<option ${checkStatusFlag eq '1'?"selected":""} value="1">已审核</option>
				</select>
			</p>
			<div class="subBar">
				<ul>
					<li style="display: none;"><div class="buttonActive">
										<div class="buttonContent">
											<button id="show_scl_search_btn" type="submit">检索</button>
										</div>
					</div></li>
					<li>
					<a class="button" href="javascript:void(0)" 
									onclick="show_scl_search()"><span>检索</span></a>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>


<div class="pageContent">
	<div class="panelBar">
		<c:choose>
			<c:when test="${empty errorMsg}">
				<ul class="toolBar">
					<li><a class="add" href="school_addUI.action" rel="school_addUI"  target="navTab" title="新增学校" ><span>新增</span></a></li>
					<li class="line">line</li>
					<li>
						<a id="edit2" href="school_editUI.action?sclId={school_id}" class="edit"   target="navTab" warn="请选择一条信息" rel="school_editUI" style="display:bolck;"><span>修改</span></a>
					</li>
					<!-- <li class="line">line</li>
					<li><a class="delete" href="school_delete.action?sclId={school_id}"  target="ajaxTodo"   title="确实要删除这些记录吗?">	<span>删除</span></a></li> -->		
					<li class="line">line</li>
					<li><a class="look" href="school_show.action?sclId={school_id}" rel="insideUser_show"  target="navTab" warn="请选择一个学校" title="查看学校"><span>查看</span>	</a></li>
					<c:if test="${currentUser.insideUser.isuGroupCode eq '1000' }">
					<li class="line" id="school_check_line">line</li>
					<li><a id="school_check" class="icon-ok" href="school_check.action?sclId={school_id}"   target="ajaxTodo" mask="true"   warn="请选择一个学校" title="确定要通过审核吗？"><span>审核</span></a></li>
					</c:if>
					<li class="line" id="school_bindEcid_line">line</li>
					<li><a id="school_bindEcid" class="icon-ok" href="school_bindEcinfoUI.action?sclId={school_id}"  rel="school_bindEcinfoUI" target="dialog" mask="true"  width="700" height="350"  resizable="true" warn="请选择一个学校" title="绑定集团客户"><span>绑定集团客户</span></a></li>
					<li class="line" style="display: none;">line</li>
					<li style="display: none;">
						<a  id="school_phone_allow" class="icon-ok" href="school_allowPhone.action?sclId={school_id}&flag=1"   target="ajaxTodo" mask="true"   warn="请选择一个学校" title="确定要允许拨打省外电话吗？"><span>允许拨打省外电话</span></a>
						<a id="school_phone_notAllow" class="icon" href="school_allowPhone.action?sclId={school_id}&flag=0"   target="ajaxTodo" mask="true"   warn="请选择一个学校" title="确定要禁止拨打省外电话吗？" style="display:none;"><span>禁止拨打省外电话</span></a>
					</li>
					<c:if test="${currentUser.insideUser.isuGroupCode eq '1000' }">
					<li class="line" >line</li>
					<li><a  id="school_bizStatus_1" class="icon-ok" href="school_bizControl.action?sclId={school_id}&flag=1"   target="ajaxTodo" mask="true"   warn="请选择一个学校" title="确定要启用该学校的业务吗？"><span>业务启用</span></a>
						<a id="school_bizStatus_0" class="icon" href="school_bizControl.action?sclId={school_id}&flag=0"   target="ajaxTodo" mask="true"   warn="请选择一个学校" title="确定要停用该学校的业务吗？" style="display:none;"><span>业务停用</span></a>
					</li>
					</c:if>
					<!--
					 <a href="schoolAction!addBossEcUi.action?id=${school.sclId }" target="dialog" rel="addBossEc">绑定</a>
					 -->
					 <c:if test="${currentUser.debug}">
						 <li class="line">line</li>
						 <li><a class="icon" href="school_removeEcid.action?sclId={school_id}"  rel="school_removeEcId" target="ajaxTodo"  warn="请选择一个学校" title="解绑集团客户"><span>解绑集团客户</span></a></li>
					 </c:if>
					 
				</ul>
			</c:when>
			<c:otherwise>
				<div style="line-height: 25px;margin-right: 20px;font-weight: normal;text-align: center;color: red;">
					${errorMsg }
				</div>
			</c:otherwise>
		</c:choose>
	
	</div>
	<div id="show_scl_list">
		
	</div>
<%-- 	<c:if test="${empty errorMsg}">
	<table class="table" width="100%" layoutH="150">
		<thead>
			<tr>
				<th width="" align="center">序号</th>
				<th width="" >地区</th>
				<th width="" >学校名称</th>
				<th width="" >学校编号</th>
				<th width="" >集团客户ID</th>
				<th width="" >卡类型</th>
				<th width="" >移动客户经理</th>
				<th width="" >拓展人员</th>
				<th width="" >维护人员</th>
				<th width="" >激励方式</th>
				<th width="" >结算方式</th>
				<th width="" >禁止拨打省外电话</th>
				<th width="" >业务状态</th>
				<th width="" >审核状态</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${recordList}" var="school" varStatus="status">
			<tr target="school_id" rel="${school.sclId }" onclick="school_doSelect(this)">
				<td>${(status.index+1) + (currentPage-1) * numPerPage}
					<input type="hidden"  id="isuId" value="${currentUser.userId}">
					<input type="hidden"  id="isuRoleCode" value="${currentUser.insideUser.isuRoleCode}">
					<input type="hidden"  id=createOperId value="${school.createOperId}">
					<input type="hidden" name="checkStatusFlag" id="checkStatusFlag_${status.index}" value="${school.checkStatusFlag}"/>
					<input type="hidden" id="groupCode" value="${currentUser.insideUser.isuGroupCode}">
					<input type="hidden" id="limitTelareaFlag_${status.index}" value="${school.limitTelareaFlag}">
					<input type="hidden" id="bizStatusFlag_${status.index}" value="${school.bizStatusFlag}">
				</td>
				<td>
					${application.areaMap[school.areaCode] }
				</td>
				<td>${school.sclName }</td>
				<td>${school.sclNumber }</td>
				<td>
					<input type="hidden" id="school_ecId_${status.index}" value="${school.ecId }">
					<c:forEach var="ecInfo" items="${bossEcinfoList}">
	 					<c:if test="${ecInfo.ecId == school.ecId }">
							<a title="${ecInfo.ecName }" >${school.ecId}</a>
						</c:if>
					</c:forEach>
				</td>
				<td>
				${school.cardTypeFlag == "0" ?"M1":"FR" }</td>
				<td>
					<c:forEach var="mobManager" items="${mobManagerList}">
	 					<c:if test="${mobManager.osuId == school.mobManagerId }">
							${mobManager.osuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<c:forEach var="sale" items="${saleList}">
	 					<c:if test="${sale.isuId == school.saleUserId }">
							${sale.isuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<c:forEach var="maintain" items="${saleList}">
	 					<c:if test="${maintain.isuId == school.saleKeepId }">
							${maintain.isuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<c:forEach var="marketing" items="${marketingTypeList}">
	 					<c:if test="${marketing.dicCode == school.marketingTypeFlag }">
							${marketing.dicName}
						</c:if>
					</c:forEach>
				
				</td>
				<td>
					<c:forEach var="blance" items="${blanceTypeList}">
	 					<c:if test="${blance.dicCode == school.balanceTypeFlag }">
							${blance.dicName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<c:if test="${school.limitTelareaFlag eq '0'}">否
					</c:if>
					<c:if test="${school.limitTelareaFlag eq '1'}">是
					</c:if>
				</td>
				<td>
					<c:if test="${school.bizStatusFlag eq '0'}"><a style="color:red;text-decoration:none;" >停用</a>
					</c:if>
					<c:if test="${school.bizStatusFlag eq '1'}">启用
					</c:if>
				</td>
				<td>
					<c:choose>
						<c:when test="${school.checkStatusFlag =='1'}">
							<a style="color:green;text-decoration:none;" >
								已审核
							</a>
						</c:when>
						<c:when test="${school.checkStatusFlag =='0'}">
							<a style="color:red;text-decoration:none;" >
								未审核
							</a>
						</c:when>
					</c:choose>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<%@ include file="/WEB-INF/jsp/public/panelBar.jsp"%>	
	</c:if> --%>
</div>
<script type="text/javascript">
function school_doSelect(obj){
	var ecIdValue = $("#school_ecId_"+obj.rowIndex,navTab.getCurrentPanel()).val();
	var bindLink = $("#school_bindEcid",navTab.getCurrentPanel());
	if(ecIdValue!="" ){
		bindLink.hide();
		$("#school_bindEcid_line").hide();
	}else{
		bindLink.show();
		$("#school_bindEcid_line").show();

	}
	var checkStatus=$("#checkStatusFlag_"+obj.rowIndex,navTab.getCurrentPanel()).val();
	var limitTelareaFlag=$("#limitTelareaFlag_"+obj.rowIndex,navTab.getCurrentPanel()).val();
	var bizStatusFlag=$("#bizStatusFlag_"+obj.rowIndex,navTab.getCurrentPanel()).val();
	//var isuRoleCode=document.getElementById("isuRoleCode").value;
	var groupCode=document.getElementById("groupCode").value;
	var isuId=document.getElementById("isuId").value;
	var createOperId=document.getElementById("createOperId").value;
	var school_check=$("#school_check",navTab.getCurrentPanel());
	if(limitTelareaFlag=='0'){
		$("#school_phone_allow").hide();
		$("#school_phone_notAllow").show();
	}else{
		$("#school_phone_allow").show();
		$("#school_phone_notAllow").hide();
	}
	if(groupCode=='1000'){//如果登录人属于管理组,都能进行修改
		/* $("#edit1").hide();
		$("#edit2").show(); */
		if(checkStatus=="0"){
			school_check.show();
			$("#school_check_line").show();
		}else{
			school_check.hide();
			$("#school_check_line").hide();
		}
		if(bizStatusFlag=="0"){
			$("#school_bizStatus_1").show();
			$("#school_bizStatus_0").hide();
		}else{
			$("#school_bizStatus_1").hide();
			$("#school_bizStatus_0").show();
		}
	}else{//如果登录人不属于管理组
		/* if(isuId==createOperId){//如果是创建人
				$("#edit1").hide();
				$("#edit2").show();
		}else{
			$("#edit1").show();
			$("#edit2").hide();
		} */
		
	}
}
function message(){
	alertMsg.info("您没有权限进行修改!");
}
function show_scl_search(){
	$("#show_scl", navTab.getCurrentPanel()).attr("action","school_search.action");
	$("#show_scl", navTab.getCurrentPanel()).attr("onsubmit","return divSearch(this, 'show_scl_list');");
	$("#show_scl_search_btn",navTab.getCurrentPanel()).click();
	
}

show_scl_search();
</script>